import React from 'react';
import { BrowserRouter, NavLink, Route } from 'react-router-dom';
// 子组件
const Book = props => {
  console.log(props);
  return (
    <div>
      <h1>小说</h1>
    </div>
  );
};
const Index = () => {
  return (
    <BrowserRouter>
      <NavLink to="/book/1/100">无限恐惧</NavLink>
      <NavLink to="/book/2/100">明朝那些事</NavLink>
      <NavLink to="/book/3/100">朱元璋</NavLink>
      {/* *号表示通配符，动态路由是/：key */}
      <Route path={['/book/:id/:index']} component={Book} />
    </BrowserRouter>
  );
};
export default Index;
